home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / private / _setcrsr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  2.1 KB  |  93 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef PDCDEBUG
  5. char *rcsid__setcrsr = "$Header: C:\CURSES\private\RCS\_setcrsr.c 2.1 1993/06/18 20:23:44 MH Rel MH $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_set_cursor_mode()    - Set the cursor start and stop scan lines.
  14.  
  15.   PDCurses Description:
  16.      Sets the cursor type to begin in scan line startrow and end in
  17.      scan line endrow.  Both values should be 0-31.
  18.  
  19.   PDCurses Return Value:
  20.      This function returns OK on success and ERR on error.
  21.  
  22.   PDCurses Errors:
  23.      No errors are defined for this function.
  24.  
  25.   Portability:
  26.      PDCurses    int PDC_set_cursor_mode( int startrow, int endrow );
  27.  
  28. **man-end**********************************************************************/
  29.  
  30. int    PDC_set_cursor_mode( int startrow, int endrow )
  31. {
  32. #ifdef    OS2
  33.     VIOCURSORINFO cursorInfo;
  34. #endif
  35.  
  36. #ifdef    FLEXOS
  37.     unsigned short mybuff = 0;
  38. #endif
  39.  
  40. #ifdef PDCDEBUG
  41.     if (trace_on) PDC_debug("PDC_set_cursor_mode() - called: startrow %d endrow %d\n",startrow,endrow);
  42. #endif
  43.  
  44. #ifdef    FLEXOS
  45.     /*
  46.      * Under FLEXOS, this routine translates the input parameters in the
  47.      * following way:
  48.      *
  49.      * startrow --> visible_cursor endrow     -->    cursor type:
  50.      * underline = 0; block = 1;
  51.      *
  52.      * VCWM_CURSOR       0x0100       bit - 8 Cursor off VCWM_BLOCK    
  53.      * 0x0200       bit - 9 Block Cursor    
  54.      *
  55.      */
  56.     retcode = s_getfield(T_VIRCON, VC_MODE, 1L, (void far *) &mybuff, 2L);
  57.     if (retcode < 0L)
  58.         return( ERR );
  59.     if (startrow)
  60.         mybuff &= ~VCWM_CURSOR;
  61.     else
  62.         mybuff |= VCWM_CURSOR;
  63.  
  64.     if (endrow)
  65.         mybuff |= VCWM_BLOCK;
  66.     else
  67.         mybuff &= ~VCWM_BLOCK;
  68.  
  69.     retcode = s_setfield(T_VIRCON, VC_MODE, 1L, (void far *) &mybuff, 2L);
  70.     return( (retcode < 0L) ? ERR : OK );
  71. #endif
  72.  
  73. #ifdef    DOS
  74.     regs.h.ah = 0x01;
  75.     regs.h.ch = (unsigned char) startrow;
  76.     regs.h.cl = (unsigned char) endrow;
  77.     int86(0x10, ®s, ®s);
  78.     return( OK );
  79. #endif
  80.  
  81. #ifdef    OS2
  82.     cursorInfo.yStart = startrow;
  83.     cursorInfo.cEnd = endrow;
  84.     cursorInfo.cx = 1;
  85.     cursorInfo.attr = 0;
  86.     return (VioSetCurType (&cursorInfo, 0) == 0);
  87. #endif
  88.  
  89. #ifdef UNIX
  90.     return(0); /* this is N/A */
  91. #endif
  92. }
  93.